<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>查看邮件</title>

<script type="text/javascript">
	$(function() {

		var links = document.body.getElementsByTagName("a");
		for (var i = 0; i < links.length; i++) {
			links[i].onclick = function() {
				var fileId = this.id;
				var url = "${ctx}/basic/basicFile/download/" + fileId;
				window.parent.location.href = url;
			}
		}

		$("#tt").toolbar("align", "right");
		$("#add").click(function() {
			$.easyui.showGridSelector($.extend(userSelectOpts, {
				multiple : true,
				onEnter : function(val) {
					var $receivers = $("#receivers");
					$(val).each(function() {
						$receivers.val($receivers.val() + this.trueName + ";");
					});
					$receivers.validatebox("validate");
				}
			}));
		});
		$("#reply").click(
				function() {
					window.parent.addTab("notifyInfoReply", "回复邮件",
							"${ctx}/basic/notifyInfo/create?id=${notifyInfo.id}&action=reply");
				});
		$("#transmit").click(
				function() {
					window.parent.addTab("notifyInfoTransmit", "转发邮件",
							"${ctx}/basic/notifyInfo/create?id=${notifyInfo.id}&action=transmit");
				});

		/* $("#downLoad").click(function() {
			var fileId = $("#fileId").val();
			//$.get("${ctx}/basic/basicFile/download/" + fileId);
			var url = "${ctx}/basic/basicFile/download/" + fileId;
			window.parent.location.href = url;
		}); */

		/* function dlf(fileId){
			//var fileId = getElementsByTagName("a").id;
			alert(fileId);
			var url = "${ctx}/basic/basicFile/download/" + fileId;
			window.parent.location.href = url;
		} */

	});
</script>
</head>
<body>
	<div data-options="region:'center',fit:true,border:false">
		<div class="easyui-panel" data-options="fit:true">
			<div id="tt" class="easyui-toolbar">
				<button type="button" id="reply" class="btn btn-primary">
					<span class="glyphicon glyphicon-envelope"></span> 回复
				</button>
				<button type="button" id="transmit" class="btn btn-primary">
					<span class="glyphicon glyphicon-repeat"></span> 转发
				</button>
			</div>
			<table style="width: 100%">
				<tr bgcolor="#D1DDAA">
					<td bgcolor="#ebf4d8" style="text-align: left;">
						<div style="margin: 10px;">
							<div style="font-weight: bold; font-size: 18px; color: black;">${notifyInfo.title }</div>
							<div class="message">
								发件人：<span style="font-weight: bold; color: black;">${notifyInfo.sender.trueName }</span>
							</div>
							<div class="message">发送时间： ${notifyInfo.sendTime }</div>
							<div class="message">收件人： ${ notifyInfo.notifyContent.allReceiversName}</div>
							<c:if test="${not empty notifyInfo.notifyContent.allCcName}">
								<div class="message">抄送人： ${ notifyInfo.notifyContent.allCcName}</div>
							</c:if>
							<c:if
								test="${isSender && not empty notifyInfo.notifyContent.allBccName}">
								<div class="message">密送人： ${ notifyInfo.notifyContent.allBccName}</div>
							</c:if>
							<c:if test="${not empty basicFileList}">
								<div>
									<span>附件：</span>
								</div>
								<table>
									<c:forEach items="${basicFileList}" var="bfile">
										<tr>
											<%-- <td><input type="hidden" id="fileId" name="fileId" value="${ bfile.id}" /></td> --%>
											<td><a id="${ bfile.id}" href="#">${bfile.fileName}</a>&nbsp;&nbsp;&nbsp;<span>${bfile.fileSize}
													KB</span></td>
										</tr>
									</c:forEach>
								</table>
							</c:if>
						</div>
					</td>
				</tr>
				<tr bgcolor="#D1DDAA">
					<td colspan="2" bgcolor="#ffffff" style="text-align: left;">
						<div style="margin: 10px; font-size: 14px;">
							${ notifyInfo.notifyContent.content} <br /> <br /> <br />
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
</body>
</html>
